<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用新特性改造之前的代码案例</title>
</head>
<body>
    <h1 class="mytitle">按下F12打开控制台查看</h1>
    <script>
        //1
        // function getSum(num1, num2){
        //     var sum = num1 + num2;
        //     console.log(num1+"+"+num2+"="+(num1+num2))
        // }
        // getSum(9,74);
        function getSum(num1, num2){
            let sum = num1 + num2;
            console.log(num1+"+"+num2+"="+(num1+num2))
        }
        getSum(9,74);

        //2
        // var arr2 = [1, 2, 3];
        // 打印arr2下标为0的数 以及arr2的长度
        // console.log(arr2[0], arr2.length);

        var arr2 = [1, 2, 3];
        let [a0, a1, a3] = arr2;
        console.log(a0, arr2.length);

        //3
        // var number
        // var mynumber = new Array()
        // mynumber[0] = 1
        // mynumber[1] = 2
        // mynumber[2] = 3

        // for (number in mynumber)
        // {
        // document.write(mynumber[number] + "<br />")
        // }
        let mynumber = new Array()
        mynumber[0] = 1
        mynumber[1] = 2
        mynumber[2] = 3

        let [number1, number2, number3] = mynumber;
        console.log(number1, number2, number3);
    </script>
</body>
</html>